package com.nanhai.buddhist.college.module.study.dal.mysql.studyplan;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.study.dal.dataobject.studyplan.StudyPlanSubjectDO;
import com.nanhai.buddhist.college.module.study.dal.dataobject.studyplan.StudyPlanTeacherDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.study.controller.admin.studyplan.vo.*;

/**
 * 教学计划课程信息 Mapper
 *
 * @author xqenzo@163.com
 */
@Mapper
public interface StudyPlanSubjectMapper extends BaseMapperX<StudyPlanSubjectDO> {

    default PageResult<StudyPlanSubjectDO> selectPage(StudyPlanSubjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudyPlanSubjectDO>()
                .eqIfPresent(StudyPlanSubjectDO::getStudyPlanId, reqVO.getStudyPlanId())
                .eqIfPresent(StudyPlanSubjectDO::getStudySubjectId, reqVO.getStudySubjectId())
                .betweenIfPresent(StudyPlanSubjectDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StudyPlanSubjectDO::getCreateTime));
    }

    default List<StudyPlanSubjectDO> selectList(StudyPlanSubjectExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudyPlanSubjectDO>()
                .eqIfPresent(StudyPlanSubjectDO::getStudyPlanId, reqVO.getStudyPlanId())
                .eqIfPresent(StudyPlanSubjectDO::getStudySubjectId, reqVO.getStudySubjectId())
                .betweenIfPresent(StudyPlanSubjectDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StudyPlanSubjectDO::getCreateTime));
    }


    default Integer deleteByStudyPlanId(String id) {
        return delete(new LambdaQueryWrapperX<StudyPlanSubjectDO>().eq(StudyPlanSubjectDO::getStudyPlanId, id));
    }
}
